package websem.model;

public class Paragraph implements Comparable<Paragraph>{

	public static String TYPE_PARAGRAPH = "P";
	public static String TYPE_TITLE = "T";
	public static String TYPE_SUBTITLE = "S";
	public static String TYPE_AUTHOR = "A";

	private int id;
	private String xPath;
	private String documentName;
	private String type;
	private int count;
	private int idDocument;
	private double weight;

	public Paragraph(String type, String xPath, String docName) {
		this.type = type;
		this.xPath = xPath;
		this.documentName = docName;
		this.weight = 0.0;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getxPath() {
		return xPath;
	}

	public void setxPath(String xPath) {
		this.xPath = xPath;
	}

	public int getIdDocument() {
		return idDocument;
	}

	public void setIdDocument(int idDocument) {
		this.idDocument = idDocument;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getDocumentName() {
		return documentName;
	}

	public void setDocumentName(String documentName) {
		this.documentName = documentName;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}

	@Override
	public boolean equals(Object other) {
		if (other.getClass() != this.getClass()) {
			return false;
		} else {
			Paragraph other_p = (Paragraph) other;
			return (this.getxPath().equals(other_p.getxPath()) && this
					.getDocumentName().equals(other_p.getDocumentName()));
		}
	}

	public void addWeight(double weight) {
		this.weight += weight;
	}

	@Override
	public int compareTo(Paragraph o) {
		return Double.compare(this.getWeight(), o.getWeight());
	}
	
}
